#include<iostream>
using namespace std;
void Fun1(char* str, char* begin)
{
	if (*begin == '\0') {
		cout << str << endl;
	}
	else {
		for (char* ch = begin; *ch != '\0'; ch++) {
			char temp = *ch;
			*ch = *begin;
			*begin = temp;
			Fun1(str, begin + 1);
			temp = *ch;
			*ch = *begin;
			*begin = temp;
		}
	}
}
void Fun(char str[])
{
	if (str == NULL) {
		return;
	}
	Fun1(str, str);
}
int main()
{
	char str1[20];
	cin >> str1;
	Fun(str1);
	return 0;
}